package com.tanhua.admin.controller;

import com.tanhua.admin.service.AnalysisService;
import com.tanhua.model.vo.AnalysisGetUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
public class AnalysisController {

    @Autowired
    private AnalysisService analysisService;

    /**
     * 新增、活跃用户、次日留存率
     *
     * @param sd
     * @param ed
     * @param type
     * @return
     */
    @GetMapping("/users")
    public ResponseEntity getUsers(Long sd, Long ed, Integer type) {
        //@RequestParam(name = "sd")  @RequestParam(name = "ed") @RequestParam(name = "type")
        //调用service查询新增、活跃用户、次日留存率
        // AnalysisGetUserVo analysisGetUserVo = analysisService.getUsers(sd, ed, type);
        //返回Vo对象给前端
        //return ResponseEntity.ok(analysisGetUserVo);
        //调用service查询新增、活跃用户、次日留存率
        AnalysisGetUserVo analysisGetUserVo = analysisService.getUsers(sd, ed, type);
        return ResponseEntity.ok(analysisGetUserVo);
    }
}
